package com.example.flashsales.config;

import com.example.flashsales.interceptor.UserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置
 */
@Configuration
public class UserInterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        UserInterceptor testInterceptor = new UserInterceptor();
        //配置拦截路径
        //UserController
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/viewUserMessage");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/modifyPasswordByPassword");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/viewUserMoney");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/payMoneyByBalance");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/viewCostRecord");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/logout");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/getVolume");


        //UserOrderController
        registry.addInterceptor(testInterceptor).addPathPatterns("/userOrder/viewOrders");
        registry.addInterceptor(testInterceptor).addPathPatterns("/userOrder/viewOrdersByTime");
        registry.addInterceptor(testInterceptor).addPathPatterns("/userOrder/setOrder");
        registry.addInterceptor(testInterceptor).addPathPatterns("/userOrder/refund");
        registry.addInterceptor(testInterceptor).addPathPatterns("/userOrder/viewRefundDetails");
        registry.addInterceptor(testInterceptor).addPathPatterns("/userOrder/viewAllRefund");
        registry.addInterceptor(testInterceptor).addPathPatterns("/userOrder/viewRefundByState");
        registry.addInterceptor(testInterceptor).addPathPatterns("/userOrder/deleteOrders");
        registry.addInterceptor(testInterceptor).addPathPatterns("/userOrder/deleteRefundOrder");


        //StoreController
        registry.addInterceptor(testInterceptor).addPathPatterns("/store/viewStoreMessage");
        registry.addInterceptor(testInterceptor).addPathPatterns("/store/modifyPasswordByOldPassword");
        registry.addInterceptor(testInterceptor).addPathPatterns("/store/viewMoney");
        registry.addInterceptor(testInterceptor).addPathPatterns("/store/viewInviteCode");

        //StoreCostRecordController
        registry.addInterceptor(testInterceptor).addPathPatterns("/store/costRecord/viewAllStoreCostRecord");
        registry.addInterceptor(testInterceptor).addPathPatterns("/store/costRecord/viewStoreRecordByTimeAndState");


        //StoreOrderController
        registry.addInterceptor(testInterceptor).addPathPatterns("/store/order/viewAllOrders");
        registry.addInterceptor(testInterceptor).addPathPatterns("/store/order/viewOrdersByTime");
        registry.addInterceptor(testInterceptor).addPathPatterns("/store/order/updateOrderState");
        registry.addInterceptor(testInterceptor).addPathPatterns("/store/order/updateOrderByArrive");



        //OrderCarController
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/orderCar/addGoodsInOrderCar");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/orderCar/addGoodsInOrderCar");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/orderCar/changeOrderCarGoodsCount");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/orderCar/cleanOrderCar");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/orderCar/viewUserOrderCarMessage");
        registry.addInterceptor(testInterceptor).addPathPatterns("/user/orderCar/deleteGoodsInOrderCar");


        //AdminController
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/updateStoreUserMoney");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/updateStoreOrderMoney");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewStore");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewStoreMessage");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/updateStoreState");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/updateTimeConfig");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewRefundByState");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewAllRefund");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewRefundDetails");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/registerStore");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/addReturnRecord");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewOrdersByTime");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewAllOrderByStore");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/updateOrderDetailsState");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewStoreByState");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewOrdersByUserPhoneAndTime");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewAllCostRecord");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewCostRecord");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewWeightByAllGoods");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewOrderByDay");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/updateRefundDetailsState");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewOrderDetailsVo");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/addStockRecord");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewAllStock");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewAllOrderByTimeAndState");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewAllUser");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewUserCostRecord");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewAdminMessage");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewStoreUser");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewStoreCostRecordByStoreId");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewAllDetails");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewSortRecord");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewCost");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/admin/viewStoreRecordByTimeAndState");


//        //GoodsController
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/addType");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/updateType");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/deleteType");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/deleteGoods");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/updateDetails");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/addGoods");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/updateGoodsType");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/updatePrice");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/updateCount");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/updateName");
//        registry.addInterceptor(testInterceptor).addPathPatterns("/goods/updateUrl");

        //OrderController
        registry.addInterceptor(testInterceptor).addPathPatterns("/order/viewOrderById");
        registry.addInterceptor(testInterceptor).addPathPatterns("/order/viewRefundById");

    }
}
